package com.cbb.display.controller;


import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cbb.display.config.core.RetResult;
import com.cbb.display.entity.SysTask;
import com.cbb.display.service.SysTaskService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bigbomb
 * @since 2020-01-17
 */
@RestController
@RequestMapping("/today-data")
public class TodayDataController {
	@Autowired
	private SysTaskService sysTaskService;
    @PostMapping("/addjobOrder")
    public RetResult addjob() {
    LocalDateTime localDateTime= LocalDateTime.now();
    localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    SysTask sysTask = SysTask.builder()
    		.beanClass("com.cbb.display.config.quartz.job.TodayJobOrder")
    		.createBy("bigbomb")
    		.createDate(localDateTime)
    		.cronExpression("*/5 * * * * ?")
    		.jobGroup("test")
    		.jobName("todaydatajob")
    		.jobStatus("1")
    		.build();
    int status = sysTaskService.addJob(sysTask);
    RetResult result = new RetResult();
    result.setData(status);
	return result;
    	
    }
    
    
    
    
}
